﻿using System;

namespace TestAnimation
{
    class Bullet
    {
        public Vector position;
        public Vector velocity;
        public int life;
        public BulletType bulletType;

        internal enum BulletType
        {
            GOOD,BAD
        }

        public Bullet(){}

        public Bullet(Ship ship)
        {
            position = ship.BulletExitPoint;
            velocity = new Vector(60, 0).Rotate((float)(ship.ObjectOrientation * Math.PI / 180)) + ship.Velocity;
            life = Globals.bulletMaxLife;
            bulletType = BulletType.GOOD;
        }
        public bool Move()
        {
            position+=velocity;
            if (position.X > Globals.maxX + 2) position.X = 2;
            if (position.Y > Globals.maxY + 2) position.Y = -2;
            if (position.X < -2) position.X = Globals.maxX + 2;
            if (position.Y < -2) position.Y = Globals.maxY + 2;
            return (--life>0);
        }
        public void Draw(Screen screen)
        {
            screen.Add(this);
        }
    }
}
